import request from '@/utils/request';

// 获取用户详细信息
export function getUserInfo() {
  return request({
    url: '/oauth2/get_user_info',
    method: 'get'
  });
}

// 获取系统权限id列表
export function getPermissions() {
  return request({
    url: '/permissions',
    method: 'get'
  });
}

// 获取公司/部门/用户集合
export function getAllUser() {
  return request({
    url: '/oauth2/acc_structure',
    method: 'get'
  });
}

// 获取公司列表
export function getCompanyList() {
  return request({
    url: '/company_list',
    method: 'get'
  });
}

// 图片上传
export function upload(data, onDownloadProgress) {
  return request({
    url: '/common/store/upload',
    headers: {
      repeatSubmit: false
    },
    onDownloadProgress,
    method: 'post',
    data
  });
}

// 下载所有图片
export function downloadOther(data) {
  return request({
    url: `/common/store/download_other`,
    method: 'get',
    timeout: 60000,
    responseType: 'blob',
    params: data
  });
}

// 根据地址下载文件
export function downloadImage(data) {
  return request({
    url: `/common/store/download_file`,
    method: 'get',
    timeout: 60000,
    responseType: 'blob',
    params: data
  });
}

// 导出进度
export function exportProgress(params) {
  return request({
    url: '/common/export/progress',
    method: 'get',
    params
  });
}

// 测试vmlogin是否打开
export function testVmLogin(params) {
  return request({
    url: 'http://127.0.0.1:35000/api/v1/profile/active',
    method: 'get',
    isProfileStart: true,
    withCredentials: false,
    timeout: 0,
    params
  });
}

// 指纹出库
export function fb_account_get(params) {
  return request({
    url: '/company/resource/fb_account/warehouse',
    method: 'get',
    params
  });
}

//启动指纹
export function startFingerprint(params) {
  return request({
    url: 'http://127.0.0.1:35000/api/v1/profile/start',
    method: 'get',
    isProfileStart: true,
    withCredentials: false,
    timeout: 0,
    params
  });
}
